<!-- HTML5文件 -->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
		<title>微信绑定注册页</title>
		<link rel="stylesheet" href="assets/agile/css/agile.layout.css">
		<link rel="stylesheet" href="assets/agile/css/flat/flat.component.css">
		<link rel="stylesheet" href="assets/agile/css/flat/flat.color.css">
		<link rel="stylesheet" href="assets/agile/css/flat/iconline.css">
		<link rel="stylesheet" href="assets/agile/css/flat/iconform.css">
		<link rel="stylesheet" href="assets/component/timepicker/timepicker.css">
		<link rel="stylesheet" href="assets/app/css/app.css">
		<link rel="stylesheet" href="assets/my/common/style.css" />
	</head>
	<body>
		<div id="section_container">
			<!--更改手机号-->
			<section id="findMM_section" data-role="section" class="active">
				<header>
					<div class="titlebar">
				    	<a data-toggle="back" href="#"><i class="iconfont iconline-arrow-left"></i></a>
						<h1 class="title">找回密码</h1>
					</div>

				</header>

				<article data-role="article" id="article" data-scroll="verticle" class="active" style="top:44px;bottom:50px;">
					<div class="scroller">
						<form autocomplete="off" class="form-common">
							<br/>
							<br/>
							<br/>
							<label class="label-left">密码:</label>
							<label class="label-right">
								<input id="pwd" type="password" placeholder="请输入您的密码"/>
							</label>
							<hr/>
							<br/>
							<label class="label-left">手机号:</label>
							<label class="label-right">
								<input id="phone1" type="text" placeholder="请输入新手机号"/>
							</label>
							<hr/>
							<label class="label-left">验证码:</label>
							<label class="label-right">
								<input id="code1" type="text" placeholder="点击获取-->"size="8" />
								<button class="right" id="yzmBTN1">验证码</button>
							</label>
							<hr/>
							
							<br/>
							<br/>
							<br/>
							<button class="block submit" id="zhmmBTN">更改</button>
							<br/>
						</form>
					</div>
				</article>
			</section>
		</div>
		
		<!--- third --->
		<script src="assets/third/zepto/zepto.min.js"></script>
		<script src="assets/third/iscroll/iscroll-probe.js"></script>
		<script src="assets/third/arttemplate/template-native.js"></script>
		<!-- agile -->
		<script type="text/javascript" src="assets/agile/js/agile.js"></script>		
		<!--- bridge --->
		<script type="text/javascript" src="assets/bridge/exmobi.js"></script>
		<script type="text/javascript" src="assets/bridge/agile.exmobi.js"></script>
		<!-- app -->
		<script src="assets/component/timepicker/agile.timepicker.js"></script>	
		<script type="text/javascript" src="assets/component/extend.js"></script>
		<script type="text/javascript" src="assets/app/js/app.js"></script>
		<!-- my -->
		<script type="text/javascript" src="assets/my/common/my.js"></script>
		<script>
		if(! getCookie("UserID")>0){//进行登陆判断,是否有相应的cookie
			A.alert('错误','请先进行登陆操作',function(){
			    A.Controller.html("login.html"); 
			});
		}
		//找回密码所对应的js
		$('#yzmBTN1').on(A.options.clickEvent,function(){
			var reg=/^13[0-9]{9}$|14[0-9]{9}|15[0-9]{9}$|18[0-9]{9}$/;
			var user = $('#phone1').val();
			if(!user || !reg.test(user)){
				A.alert('提示','请先输入手机号');
			}else{
				time(this);
				var _url=encodeURIComponent("http://182.92.241.133:8001/API/FrontBackInf/GetCode?Phone="+user);
				myAjax(_url,yzmOK);//进行跨域请求json
			}
		});
		function yzmOK(json){
			$('#code1').val(json.RObject.VerifyCode);
		}
		
		//点击找回密码按钮
		$('#zhmmBTN').on(A.options.clickEvent,function(){
			var reg=/^13[0-9]{9}$|14[0-9]{9}|15[0-9]{9}$|18[0-9]{9}$/;
			var user = $('#phone1').val();
			var pwd = $('#pwd').val();
			var code = $('#code1').val();
			if(!user || !reg.test(user)){
				A.alert('错误','请输入手机号');
			}else if(!code){
				A.alert('提示','请填写验证码');
			}else if(!pwd){
				A.alert('提示','请填写密码');
			}else{
				var _url=encodeURIComponent("http://182.92.241.133:8001/API/FrontBackInf/UpdateTelephone?userID="+getCookie("UserID")+"&teleNo="+user+"&verifyCode="+code+"&pwd="+pwd);
				myAjax(_url,regOk);//进行跨域请求json
			}
			return false;
		});
		function regOk(json){
			A.showToast('绑定手机修改成功!');
			setTimeout(function() {
					A.Controller.back();
				},2500);
		}
		
		
		
		
		//倒计时显示验证码
		var wait=60;  
		function time(o) {
			if (wait == 0) {
				o.removeAttribute("disabled");
				o.innerHTML="验证码";
				wait = 60;
			} else {
				o.setAttribute("disabled", true);
				o.innerHTML=wait;
				wait--;
				setTimeout(function() {
					time(o)
				},1000);
			} 
    	}  
		</script>
		
	</body>
</html>